#include <iostream>
#include <algorithm>

using namespace std;

const int N = 1e5 +5;

int  a[N];

void find_sum(int a[], int n, int m){
    sort(a, a + n);

    int i = 0, j = n - 1;
    
    while (i < j){
        int sum = a[i] + a[j];

        if (sum > m){
            --j;
        }else if(sum < m){
            ++i;
        }else{
            cout << a[i++] << " " << a[j] << endl;
        }
    }
}

int main(){
    int n, m;
    cin >> n;
   
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    
    cin >> m;
    find_sum(a, n, m);

    return 0;
}